{extend name="Layout:edit" /}
{block name="content"}
<!-- form start -->
<form class="form-horizontal" action="{:U('roleSave')}" method="post">
    <div class="box-body">
        <table class=".xsui-datatable table table-condensed table-bordered table-striped table-hover" data-comboboxurl="{:U('Role/getTreeJson')}">
            <thead>
            <th>用户名</th>
            <th>角色</th>
            </thead>
            <tbody>
                {foreach name="list" item="vo"}
                <tr>
                    <td>{$vo.user_name}<input type="hidden" name="id[]" value="{$vo.id}" /></td>
                    <td><select name="role_id[]" class="form-control input-sm" data-value="{$vo.role_id}" required="required"></select></td>
                </tr>
                {/foreach}
            </tbody>
        </table>
    </div>
    <!-- /.box-body -->
    <div class="box-footer">
        <button type="button" class="btn btn-default xsui-btn-close-dialog">取消</button>
        <button type="submit" class="btn btn-primary pull-right">保存</button>
    </div>
    <!-- /.box-footer -->
</form>
{/block}
{block name="script_before"}
<script type="text/javascript">
    $('select[name="role_id[]"]').ajaxcomboboxes({url: $('.table').data('comboboxurl'), first: {"id": "", "text": "选择角色"}});
</script>
{/block}